/**
 * Author: w景洋.
 * Time: 2016/7/21 0021
 */
angular.module('service.filter', [])
    //过滤器Filter
    .service('FilterService', ['$resource', function ($resource) {

        this.transSex = function (input) {
            var sex = null;
            if (input == '1') {
                sex = "先生";
            } else if (input == "2") {
                sex = "女士";
            } else {
                sex = "";
            }
            return sex;
        }

        this.tranZipcode = function (input) {
            var area = null;
            if (input == '350101') {
                area = "福州市鼓楼区";
            } else if (input == '330329') {
                area = "温州市泰顺县";
            }
            return area;
        }
        this.tranStatus = function (input) {
            var orderStatus = null;
            if (input.status == '0' && input.paystate != '1') {
                orderStatus = "继续支付";
            }
            else if (input.status == '1') {
                orderStatus = "确认收货";
            }
            else if (input.status == '2') {
                orderStatus = "立即评价";
            }
            return orderStatus;
        }

    }])
    .filter('transtatus', ['FilterService', function (FilterService) {
        return function (input) {
            return FilterService.tranStatus(input);
        };
    }])
    .filter('transsex', ['FilterService', function (FilterService) {
        return function (input) {
            return FilterService.transSex(input);
        };
    }])
    .filter('tranzipcode', ['FilterService', function (FilterService) {
        return function (input) {
            return FilterService.tranZipcode(input);
        };
    }])

    .filter('payTypeFilter',[function(){
        return function(payType) {
            if(payType==0){
                payType='在线支付';
            }else if(payType==4){
                payType='货到付款 ';
            }
            return payType;
        }
    }])
    .filter('byMessageFilter',[function(){
        return function(Message) {
            if(Message==''){
                Message='无';
            }
            return Message;
        }
    }])